function w = hermite_genz_keister_lookup_weights ( n )

%*****************************************************************************80
%
%% HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS: Hermite Genz-Keister weights.
%
%  Discussion:
%
%    The integral:
%
%      integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
%
%    The quadrature rule:
%
%      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
%
%    A nested family of rules for the Hermite integration problem
%    was produced by Genz and Keister.  The structure of the nested
%    family was denoted by 1+2+6+10+16, that is, it comprised rules 
%    of successive orders O = 1, 3, 9, 19, and 35.
%
%    The precisions of these rules are P = 1, 5, 15, 29, and 51.
%
%    Three related families begin the same way, but end with a different final
%    rule.  As a convenience, this function includes these final rules as well:
%
%    Designation  Orders       Precisions
%
%    1+2+6+10+16, 1,3,9,19,35  1,5,15,29,51
%    1+2+6+10+18  1,3,9,19,37  1,5,15,29,55
%    1+2+6+10+22  1,3,9,19,41  1,5,15,29,63
%    1+2+6+10+24  1,3,9,19,43  1,5,15,29,67
%
%    Some of the data in this function was kindly supplied directly by
%    Alan Genz on 24 April 2011.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    04 October 2011
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Alan Genz, Bradley Keister,
%    Fully symmetric interpolatory rules for multiple integrals
%    over infinite regions with Gaussian weight,
%    Journal of Computational and Applied Mathematics,
%    Volume 71, 1996, pages 299-309
%
%    Florian Heiss, Viktor Winschel,
%    Likelihood approximation by numerical integration on sparse grids,
%    Journal of Econometrics,
%    Volume 144, 2008, pages 62-80.
%
%    Thomas Patterson,
%    The Optimal Addition of Points to Quadrature Formulae,
%    Mathematics of Computation,
%    Volume 22, Number 104, October 1968, pages 847-856.
%
%  Parameters:
%
%    Input, integer N, the order.
%    N must be 1, 3, 9, 19, 35, 37, 41 or 43.
%
%    Output, real W(N), the weights.
%
  w = zeros ( n, 1 );

  if ( n == 1 )

    w( 1) =   1.7724538509055159E+00;

  elseif ( n == 3 )

    w( 1) =   2.9540897515091930E-01;
    w( 2) =   1.1816359006036772E+00;
    w( 3) =   2.9540897515091930E-01;

  elseif ( n == 9 )

    w( 1) =   1.6708826306882348E-04;
    w( 2) =   1.4173117873979098E-02;
    w( 3) =   1.6811892894767771E-01;
    w( 4) =   4.7869428549114124E-01;
    w( 5) =   4.5014700975378197E-01;
    w( 6) =   4.7869428549114124E-01;
    w( 7) =   1.6811892894767771E-01;
    w( 8) =   1.4173117873979098E-02;
    w( 9) =   1.6708826306882348E-04;

  elseif ( n == 19 )

    w( 1) =   1.5295717705322357E-09;
    w( 2) =   1.0802767206624762E-06;
    w( 3) =   1.0656589772852267E-04;
    w( 4) =   5.1133174390883855E-03;
    w( 5) =  -1.1232438489069229E-02;
    w( 6) =   3.2055243099445879E-02;
    w( 7) =   1.1360729895748269E-01;
    w( 8) =   1.0838861955003017E-01;
    w( 9) =   3.6924643368920851E-01;
    w(10) =   5.3788160700510168E-01;
    w(11) =   3.6924643368920851E-01;
    w(12) =   1.0838861955003017E-01;
    w(13) =   1.1360729895748269E-01;
    w(14) =   3.2055243099445879E-02;
    w(15) =  -1.1232438489069229E-02;
    w(16) =   5.1133174390883855E-03;
    w(17) =   1.0656589772852267E-04;
    w(18) =   1.0802767206624762E-06;
    w(19) =   1.5295717705322357E-09;

  elseif ( n == 35 )

    w( 1) =   1.8684014894510604E-18;
    w( 2) =   9.6599466278563243E-15;
    w( 3) =   5.4896836948499462E-12;
    w( 4) =   8.1553721816916897E-10;
    w( 5) =   3.7920222392319532E-08;
    w( 6) =   4.3737818040926989E-07;
    w( 7) =   4.8462799737020461E-06;
    w( 8) =   6.3328620805617891E-05;
    w( 9) =   4.8785399304443770E-04;
    w(10) =   1.4515580425155904E-03;
    w(11) =   4.0967527720344047E-03;
    w(12) =   5.5928828911469180E-03;
    w(13) =   2.7780508908535097E-02;
    w(14) =   8.0245518147390893E-02;
    w(15) =   1.6371221555735804E-01;
    w(16) =   2.6244871488784277E-01;
    w(17) =   3.3988595585585218E-01;
    w(18) =   9.1262675363737921E-04;
    w(19) =   3.3988595585585218E-01;
    w(20) =   2.6244871488784277E-01;
    w(21) =   1.6371221555735804E-01;
    w(22) =   8.0245518147390893E-02;
    w(23) =   2.7780508908535097E-02;
    w(24) =   5.5928828911469180E-03;
    w(25) =   4.0967527720344047E-03;
    w(26) =   1.4515580425155904E-03;
    w(27) =   4.8785399304443770E-04;
    w(28) =   6.3328620805617891E-05;
    w(29) =   4.8462799737020461E-06;
    w(30) =   4.3737818040926989E-07;
    w(31) =   3.7920222392319532E-08;
    w(32) =   8.1553721816916897E-10;
    w(33) =   5.4896836948499462E-12;
    w(34) =   9.6599466278563243E-15;
    w(35) =   1.8684014894510604E-18;

  elseif ( n == 37 )

    w( 1) = 0.337304188079177058E-20;
    w( 2) = 0.332834739632930463E-16;
    w( 3) = 0.323016866782871498E-13;
    w( 4) = 0.809333688669950037E-11;
    w( 5) = 0.748907559239519284E-09;
    w( 6) = 0.294146671497083432E-07;
    w( 7) = 0.524482423744884136E-06;
    w( 8) = 0.586639457073896277E-05;
    w( 9) = 0.571885531470621903E-04;
    w(10) = 0.41642095727577091E-03;
    w(11) = 0.174733389581099482E-02;
    w(12) = 0.313373786000304381E-02;
    w(13) = 0.768092665770660459E-02;
    w(14) = 0.274962713372148476E-01;
    w(15) = 0.783630990508037449E-01;
    w(16) = 0.16611584261479281D+00;
    w(17) = 0.253636910481387185D+00;
    w(18) = 0.261712932511430884D+00;
    w(19) = 0.171719680968980257D+00;
    w(20) = 0.261712932511430884D+00;
    w(21) = 0.253636910481387185D+00;
    w(22) = 0.16611584261479281D+00;
    w(23) = 0.783630990508037449E-01;
    w(24) = 0.274962713372148476E-01;
    w(25) = 0.768092665770660459E-02;
    w(26) = 0.313373786000304381E-02;
    w(27) = 0.174733389581099482E-02;
    w(28) = 0.41642095727577091E-03;
    w(29) = 0.571885531470621903E-04;
    w(30) = 0.586639457073896277E-05;
    w(31) = 0.524482423744884136E-06;
    w(32) = 0.294146671497083432E-07;
    w(33) = 0.748907559239519284E-09;
    w(34) = 0.809333688669950037E-11;
    w(35) = 0.323016866782871498E-13;
    w(36) = 0.332834739632930463E-16;
    w(37) = 0.337304188079177058E-20;

  elseif ( n == 41 )

    w( 1) =   0.117725656974405367E-22;
    w( 2) =   0.152506745534300636E-18;
    w( 3) =   0.202183949965101288E-15;
    w( 4) =   0.724614869051195508E-13;
    w( 5) =   0.103121966469463034E-10;
    w( 6) =   0.710371395169350952E-09;
    w( 7) =   0.264376044449260516E-07;
    w( 8) =   0.558982787078644997E-06;
    w( 9) =   0.675628907134744976E-05;
    w(10) =   0.512198007019776873E-04;
    w(11) =   0.335013114947200879E-03;
    w(12) =   0.249379691096933139E-02;
    w(13) = - 0.25616995850607458E-01;
    w(14) =   0.317007878644325588E-01;
    w(15) =   0.125041498584003435E-02;
    w(16) =   0.293244560924894295E-01;
    w(17) =   0.799536390803302298E-01;
    w(18) =   0.164543666806555251D+00;
    w(19) =   0.258718519718241095D+00;
    w(20) =   0.293588795735908566D+00;
    w(21) =   0.997525375254611951E-01;
    w(22) =   0.293588795735908566D+00;
    w(23) =   0.258718519718241095D+00;
    w(24) =   0.164543666806555251D+00;
    w(25) =   0.799536390803302298E-01;
    w(26) =   0.293244560924894295E-01;
    w(27) =   0.125041498584003435E-02;
    w(28) =   0.317007878644325588E-01;
    w(29) = - 0.25616995850607458E-01;
    w(30) =   0.249379691096933139E-02;
    w(31) =   0.335013114947200879E-03;
    w(32) =   0.512198007019776873E-04;
    w(33) =   0.675628907134744976E-05;
    w(34) =   0.558982787078644997E-06;
    w(35) =   0.264376044449260516E-07;
    w(36) =   0.710371395169350952E-09;
    w(37) =   0.103121966469463034E-10;
    w(38) =   0.724614869051195508E-13;
    w(39) =   0.202183949965101288E-15;
    w(40) =   0.152506745534300636E-18;
    w(41) =   0.117725656974405367E-22;

  elseif ( n == 43 )

    w( 1) =   0.968100020641528185E-37;
    w( 2) =   0.15516931262860431E-22;
    w( 3) =   0.175937309107750992E-18;
    w( 4) =   0.217337608710893738E-15;
    w( 5) =   0.747837010380540069E-13;
    w( 6) =   0.104028132097205732E-10;
    w( 7) =   0.70903573389336778E-09;
    w( 8) =   0.263481722999966618E-07;
    w( 9) =   0.560127964848432175E-06;
    w(10) =   0.680410934802210232E-05;
    w(11) =   0.508343873102544037E-04;
    w(12) =   0.32753080006610181E-03;
    w(13) =   0.267479828788552937E-02;
    w(14) = - 0.687704270963253854E-02;
    w(15) =   0.119383201790913588E-01;
    w(16) =   0.248083722871002796E-02;
    w(17) =   0.29000335749726387E-01;
    w(18) =   0.798689557875757008E-01;
    w(19) =   0.164609842422580606D+00;
    w(20) =   0.258535954731607738D+00;
    w(21) =   0.292243810406117141D+00;
    w(22) =   0.102730713753441829D+00;
    w(23) =   0.292243810406117141D+00;
    w(24) =   0.258535954731607738D+00;
    w(25) =   0.164609842422580606D+00;
    w(26) =   0.798689557875757008E-01;
    w(27) =   0.29000335749726387E-01;
    w(28) =   0.248083722871002796E-02;
    w(29) =   0.119383201790913588E-01;
    w(30) = - 0.687704270963253854E-02;
    w(31) =   0.267479828788552937E-02;
    w(32) =   0.32753080006610181E-03;
    w(33) =   0.508343873102544037E-04;
    w(34) =   0.680410934802210232E-05;
    w(35) =   0.560127964848432175E-06;
    w(36) =   0.263481722999966618E-07;
    w(37) =   0.70903573389336778E-09;
    w(38) =   0.104028132097205732E-10;
    w(39) =   0.747837010380540069E-13;
    w(40) =   0.217337608710893738E-15;
    w(41) =   0.175937309107750992E-18;
    w(42) =   0.15516931262860431E-22;
    w(43) =   0.968100020641528185E-37;

  else

    fprintf ( stderr, '\n' );
    fprintf ( stderr, 'HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS - Fatal error!\n' );
    fprintf ( stderr, '  Illegal input value of N.\n' );
    fprintf ( stderr, '  N must be 1, 3, 9, 19, 35, 37, 41 or 43.\n' );
    error ( 'HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS - Fatal error!' );

  end

  return
end
